<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>课程留言板管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#value").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/business/messageboard">课程留言板</a></li>
    <li class="active"><a href="${ctx}/business/messageboard/form?id=${messageBoard.id}">课程留言板<shiro:hasPermission
            name="business:messageboard:edit">${not empty messageboard.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission
            name="business:messageboard:edit">查看</shiro:lacksPermission></a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="messageBoard" action="${ctx}/business/messageboard/save" method="post"
           class="form-horizontal">
    <form:hidden path="id"/>
    <tags:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">课程:</label>
        <div class="controls">
            <form:input path="course.title" name="course.title" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">留言时间:</label>
        <div class="controls">
            <form:input path="addTime" htmlEscape="false" maxlength="50"
                        id="addTime" onClick="WdatePicker()" placeholder="留言时间"
                        class="required Wdate span2" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">学生姓名:</label>
        <div class="controls">
            <form:input path="student.name" name="student.name" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">类型:</label>
        <div class="controls">
            <form:select path="type" name="type" class="input-medium" disabled="true">
                <form:options items="${dic:getBusDictList('messageBoard_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">留言内容:</label>
        <div class="controls">
            <form:textarea path="content" name="content" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">回复内容:</label>
        <div class="controls">
            <form:textarea path="reply" name="reply" htmlEscape="false" maxlength="500" class="required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">状态:</label>
        <div class="controls">
            <form:select path="status" name="status" class="input-medium">
                <form:options items="${dic:getBusDictList('messageBoard_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">推荐:</label>
        <div class="controls">
            <form:select path="recommend" name="recommend" class="input-medium">
                <form:options items="${dic:getBusDictList('messageBoard_recommend')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>



    <div class="form-actions">
        <shiro:hasPermission name="business:messageboard:edit"><input id="btnSubmit" class="btn btn-primary"
                                                                      type="submit"
                                                                      value="保 存"/>&nbsp;</shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
</body>
</html>